package com.timo.rabbitmq.controller;

import com.timo.constant.RabbitMqConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 类用途：
 * @Author: Timo
 * @Date: 2019/7/24 09:54
 */
@RestController
@RequestMapping("/direct")
public class DirectController {


    @Resource
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/hello")
    public void hello(String msg) {
        rabbitTemplate.convertAndSend(RabbitMqConstant.DirectExchangeEnum.HELLO_DIRECT_EXCHANGE.name,"hello.direct.key",msg);
    }
}
